package com.theaf.basemodule.common.model.car;

import com.theaf.basemodule.common.model.SysDataEx;
import com.theaf.core.annotation.FieldCn;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.*;
import java.util.List;

/**
 * @Author:songwenke
 * @Description:车型（包括品牌、车系和车型）
 * @Date:create in 9:27 2018/3/16
 * @Modified By:
 **/
@Entity
@Table(name = "car_type")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CarType {
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "user_id_req")
    @SequenceGenerator(name = "user_id_req", sequenceName = "sys_req")
    @FieldCn(value = "id")
    private long id;
    @FieldCn(value = "父id")
    @Column(name = "pid")
    private Long pid;
    @Column(name = "name")
    @NotEmpty(message = "名称不能为空")
    @FieldCn(value = "名称")
    private String name;
    @Column(name = "type")
    @FieldCn(value = "类型",note = "（1品牌2车系3车型）")
    private Integer type;
    public final static int TYPE_BRAND = 1;
    public final static int TYPE_SYS = 2;
    public final static int TYPE_MODEL = 3;
    @Column(name = "displayed")
    private boolean displayed;
    @Column(name = "img")
    private String img;
    @FieldCn(value = "国家")
    @Column(name = "country")
    private String country;
    @Column(name = "initials")
    @FieldCn(value = "首字母")
    private String initials;
    @Column(name = "use_type")
    @FieldCn(value = "用途类型")
    private String useType;
    @OneToMany(cascade={CascadeType.ALL})
    @JoinColumn(name="data_id")
    private List<SysDataEx> others;
}
